<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>成绩输入</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/bootstrap/css/bootstrap-submenu.css">
</head>
<body id="fontSize">
<!--头部引用  -->
<div class="container" id="frontTop">
</div>

<div class="container" style="margin-top: 150px">
    <form action="selectFillingBatch" method="post" onsubmit=" return judgeCategory()" target="nm_iframe">
        <div class="row">
            <div class="col-md-4">
                <h1>输入高考成绩</h1>
            </div>
        </div>
        <div class="container">
            <ul style="margin-top: 50px">
                <li>
                    <ul class="list-inline row" >
                        <li class="col-md-2 offset-1">你的科类：</li>
                        <li class="col-md-2 offset-	1">
                            <label class="radio-inline">
                                <input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"  checked> 理科
                            </label>
                        </li>
                        <li class="col-md-2 ">
                            <label class="radio-inline">
                                <input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 文科
                            </label>
                        </li>
                    </ul>
                </li>
                <li>
                    <ul  class="list-inline row" >
                        <li class="offset-1 col-md-2">你的总分：</li>
                        <li class="col-md-4"><input name="Grade" id="Grade" class="col-md-12"  type="text" onchange="displayRank1()" /></li>

                    </ul>
                </li> <li>
                <ul class="list-inline row " style="margin-top: 50px">
                    <li class="col-md-2 offset-1">你的位次：</li>
                    <li class="col-md-4"><input class="col-md-12" id="displayRank" value="（输入分数默认显示位次）" disabled></li>
                    <li ><input style="display: none" name="kelei" id="kelei"></li>
                </ul>
            </li>
                <li >
                    <input  type="submit"  value="下一步" class="btn btn-primary col-md-2 offset-4" style="margin-top: 80px">
                </li>


            </ul>
        </div>
    </form>
</div>

<!--底部信息  -->

<div class="container" id="frontBottom">
</div>
<script src="/js/jquery-3.3.0.js"></script>
<script src="/bootstrap/bootstrap.min.js"></script>
<script src="/js/publicSection.js"></script>
<script>
    //判断选择的是文理科
    var subject ="理科";
    var grade =0;
    function displayRank1() {
        //存储科类
        var storage = window.sessionStorage;
        var y=document.getElementById("Grade").value;
        //根据文理科选择相应数据库
        if($("#inlineRadio1").prop("checked"))
        {
            document.getElementById("kelei").value = "理科";
            storage.setItem("subject","理科")
            //var grade = document.getElementById("sumGrade").value;
            subject = "理科";

        }
        else if($("#inlineRadio2").prop("checked"))
        {

            document.getElementById("kelei").value = "文科";
            storage.setItem("subject","文科")

            subject = "文科";
        }

        /*连接数据查找分数对应位次  */

        //显示排名的input
        document.getElementById("displayRank").value="1000";
    }

    function judgeCategory() {
        var storage = window.sessionStorage;

        if(document.getElementById("Grade").value==""){
            alert("请填写你的分数");
            return false;
        }
        else{
            grade = document.getElementById("Grade").value;
            storage.setItem("grade",grade);
            dataJson={
                subject:subject,
                grade:grade,
            };
            debugger;
            $.ajax({
                type:"POST",
                url:"/AIEFront/gradeInputCheck",
                data:JSON.stringify(dataJson),
                // async:false, //不是异步处理
                dataType: "json",
                contentType:'application/json;charset=UTF-8', // contentType很重要
                success: function(isSuccess){
                    if(isSuccess.success=='1'){

                        window.location.href="selectFillingBatch";

                    }
                    else {
                        alert("信息有误！");
                    }
                }
            });

        }

        return true;
    }
</script>
</body>
</html>